package com.baizhi.controller;

import com.baizhi.service.FeignProductService;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {

    @Autowired
   private FeignProductService feignProductService;
    @GetMapping("users")
    @HystrixCommand(fallbackMethod = "abc")
    //当网络出现问题，执行该方法="";
    public String select(){
        String select = feignProductService.select(3);
        return "我是用户模块="+select;
    }
    public String abc(){
        return  "熔断器打开了";
    }

}
